<template>
  <div>
    <Card dis-hover>
      <Spin v-if="showSpin" size="large" fix></Spin>
      <Row type="flex" style="padding-top: 20px">
        <Col span="8">商品名称：{{ formData.salePriceTopInfoOutput.productName }}</Col>
        <Col span="5">是否敏感商品：{{ formData.salePriceTopInfoOutput.isPriceSensitive == "1" ? "是" : "否" }}</Col>
        <Col span="5">状态：已准入</Col>
      </Row>
      <Row type="flex" style="padding-top: 20px">
        <Col span="8">管理区域：{{ formData.salePriceTopInfoOutput.manageArea }}</Col>
        <Col span="5">供货计量单位：{{ formData.salePriceTopInfoOutput.supplyGoodsUnit }}</Col>
      </Row>
      <div>
        <div class="cardRow">商品价格信息</div>
        <sku-table
          :columns="columnsdata"
          :dataSource="formData.salepriceList"
        />
      </div>
    </Card>
  </div>
</template>

<script>
import { ApiRequest } from '@api/basePage';
import util from '@/libs/util';
import SkuTable from '@/components/skusTable';
import { VIEW_RECORD_TABLE_COLUMNS as NEW_SALE_TABLE_COLUMNS } from '@/constants/salePrice';
export default {
  components: {
    SkuTable
  },
  data () {
    return {
      showSpin: false,
      productUuid: '', // 商品uuid
      formData: {
        salepriceList: [],
        salePriceTopInfoOutput: {},
      },
      columnsdata: NEW_SALE_TABLE_COLUMNS,
    };
  },
  mounted () {},
  created () {
    this.productUuid = util.Pub.getStorageSync('productUuidDetail');
    // this.initData();
  },
  methods: {
    getPageData () {
      if (this.isInit()) {
        let data = {
          productUuid: this.productUuid
        };
        this.showSpin = true;
        ApiRequest(
          '/sysback/salePrice/secondPhase/others/getSalePriceByProductUuid',
          'get',
          data
        ).then((res) => {
          this.showSpin = false;
          if (res.retStatus === '1') {
            this.formData = res.retData;
            this.formData.salepriceList = res?.retData?.salepriceList ?? [];
          }
        });
      }
    },
    isInit () {
      return !this.formData.salePriceTopInfoOutput.productName
    }
  }
};
</script>

<style lang="less" scoped>
.cardRow {
  height: 50px;
  line-height: 50px;
}
</style>
